home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / msdos / mxmenu.zip / LOGIN.MNU < prev    next >
Text File  |  1993-07-11  |  23KB  |  973 lines

  1. Comment
  2. ========================================================
  3.  
  4. Copyright 1990-93 by Marc Perkel * All right reserved.
  5.  
  6. MarxMenu now allows you to login to a Novell network without using
  7. Novell's login program or messing with nasty login scripts. You can
  8. be in MarxMenu all the way in.
  9.  
  10. Before you start on this make sure you have read the Novell section of
  11. the MarxMenu manual. This menu is somewhat tricky and requires some
  12. study before you dive right in.
  13.  
  14. Logging into Novell is tricky. Especially if you are using boot roms
  15. on your network cards. Through much trial and error, I have found
  16. some solid tricks that make life easier.
  17.  
  18. You should have the following two BATCH files in your LOGIN
  19. directory as follows:
  20.  
  21. LOADNET.BAT  ;if used with BESTNET
  22. -----------
  23. %NET%
  24. %NETD%
  25. Set NET=
  26. Set NETD=
  27. Startup
  28.  
  29. LOADNET.BAT  ;if not used with BESTNET
  30. -----------
  31. NETX
  32. F:
  33. Startup
  34.  
  35. STARTUP.BAT
  36. -----------
  37. SET BOOTUP=LOGIN
  38. SET LOGINDIR=Y
  39. MarxMenu Login
  40. %BOOTUP%
  41.  
  42. Each workstation should have their own AUTOEXEC.BAT. The last line
  43. should be LOADNET. If you are running multiple versions of dos or a
  44. variety of computers you should run BESTNET as part of your bootup
  45. sequence.
  46.  
  47. Also, if you want automatic login you can add the following lines to you
  48. AUTOEXEC.BAT file:
  49.  
  50. SET USERNAME=MARC   Your Name Here
  51. SET PASSWORD=NERD   Your Password Here
  52.  
  53. You should also change the COMSPEC= to the network command.com BEFORE
  54. you run NETX. For some unknown reason, this solves a lot of problems.
  55.  
  56. Example:
  57.  
  58. IPX
  59. SET COMSPEC=O:COMMAMD.COM
  60. NETX
  61.  
  62. Another boot rom quirk is that you can't run any program off a boot
  63. rom that trashes upper memory. An example is running QEMM on a
  64. monochrome monitor.
  65.  
  66. By using this method the boot disk or boot rom hands control over in
  67. a clean way. LOADNET.BAT then branches to STARTUP.BAT for the rest
  68. of the login sequence.
  69.  
  70. For some strange reason which I can't explain, LOADNET and STARTUP
  71. have to be two separate batch files. I think it forces the transient
  72. part of COMMAND.COM to load into memory. Anyhow, don't combine these
  73. into one batch file
  74.  
  75. The first line of STARTUP.BAT is a message that tells this menu that
  76. the user is logging in for the first time. This menu creates a batch
  77. file and puts the name of it in the environment variable BOOTUP.
  78. STARTUP.BAT then executes this file.
  79.  
  80. This is the example for MY network. You'll have to modify it for
  81. yours. I'm doing a lot of tricky things in my login. Your login might
  82. not need to be as complex as mine.
  83.  
  84. One word of caution. After modifing this menu, always run MARXCOMP
  85. LOGIN to compile it. Otherwise, if you boot up into it you won't
  86. have enough access rights to recompile automatically. I do this by
  87. making a file called L.BAT.
  88.  
  89. ME LOGIN.MNU
  90. MARXCOMP LOGIN.MNU
  91.  
  92. ========================================================
  93. EndComment
  94.  
  95. var
  96.    UserName
  97.    OldPass
  98.    NewPass
  99.    Logged
  100.    Station
  101.    SmartDir
  102.    MyServer
  103.    OrigServer
  104.    HomeDir
  105.    DosDir
  106.    Shell
  107.    Vols
  108.    PasswordExpDays
  109.    SkipError
  110.    NameAgain
  111.    Servers
  112.    StatusWin
  113.    TsrLoaded
  114.    DrDos6
  115.    MyGroups
  116.  
  117. Comment
  118. ========================================================
  119.  
  120. If you are using 386 NetWare then make sure you copy the program
  121. SUBLOGIN.EXE to the LOGIN directory. This will allow you to do encrypted
  122. logins. Or you can run:
  123.  
  124. SET ALLOW UNENCRYPTED PASSWORDS = ON
  125.  
  126. ========================================================
  127. EndComment
  128.  
  129. Shell = CleanFileName(%COMSPEC%)
  130. MyServer = NovDefaultServer
  131. OrigServer = MyServer
  132. NovServers(Servers)
  133. Logged = %LOGGED% = 'TRUE'
  134.  
  135. NovBroadcastMode 3        ;prevent sends from locking up boot
  136. SkipError = False
  137.  
  138. TryAutoLogin  ;login using environment variables
  139.  
  140. if not Logged then LoginFromScreen
  141.  
  142. NovSetPrimaryServer (MyServer)
  143. NovSetPreferredServer (MyServer)
  144.  
  145. NovReadGroups(UserName,MyGroups)    ;Read Groups user is in.
  146. SortArray(MyGroups)
  147.  
  148. UserName = NovLoginName
  149.  
  150. %LOGGED% = ''
  151. %USERNAME% = UserName
  152. %PASSWORD% = ''
  153.  
  154. ;----- Another Server Selected
  155.  
  156. if MyServer <> OrigServer
  157.    %BOOTUP% = 'STARTUP'
  158.    %LOGGED% = 'TRUE'
  159.    NovMapDrive('F',MyServer + '/SYS:LOGIN')
  160.    ChDir('F:\LOGIN')
  161.    ExitMenu
  162. endif
  163.  
  164. ;----- You can't assume that you have an F: drive unless you map it.
  165.  
  166. NovMapDrive ('F','SYS:LOGIN')
  167.  
  168. Comment
  169. ========================================================
  170.  
  171. If a TEMP environment variable is set, MarxMenu will use it for
  172. temporary batch files. This is compatible with DOS 5 and Windows
  173. conventions. The users should be given full access rights to this
  174. directory. I'm using \TMPFILES for my network.
  175.  
  176. ========================================================
  177. EndComment
  178.  
  179. if ExistDir('F:\TMPFILES') then %TEMP% = 'F:\TMPFILES'
  180.  
  181. ;----- Here we calculate a home directory for each user.
  182.  
  183. HomeDir = 'SYS:HOME\' + UserName
  184. if UserName = 'SUPERVISOR' then HomeDir = 'SYS:SYSTEM'
  185. if not ExistDir(HomeDir) then HomeDir = 'SYS:PUBLIC\UTIL'
  186.  
  187. Comment
  188. ========================================================
  189.  
  190. Here we calulate the the name of the dos directory that matches the
  191. version of dos we are running. The directory for DOS 5.0 would be
  192. SYS:PUBLIC\DOSV5.00
  193.  
  194. ========================================================
  195. EndComment
  196.  
  197. DosDir = 'F:\PUBLIC\DOSV' + DosVersionString
  198.  
  199. ;----- DR DOS (NovOS)
  200.  
  201. if %OS% > ''
  202.    DosDir = 'F:\PUBLIC\' + %OS% + %VER%
  203.    DrDos6 = Value(%VER%) >= 6
  204.    if DrDos6
  205.       Bat('SHARE.EXE')
  206.    endif
  207. endif
  208.  
  209. %DOSDiR% = DosDir
  210. if not ExistDir(DosDir) then DosDir = ''
  211.  
  212. Comment
  213. ========================================================
  214.  
  215. Here's where we map our drives. This does not set the search path.
  216. You set that explicitly by writing to the PATH environment variable.
  217.  
  218. SYS:--+---PUBLIC---NSK
  219.       |     |
  220.       |     +------UTIL
  221.       |     |
  222.       |     +------DOSV5.00
  223.       |     |
  224.       |     +------DRDOS6.0
  225.       |
  226.       +---HOME-----MARC
  227.       |     |
  228.       |     +------VICKI
  229.       |
  230.       +---LOGIN
  231.  
  232. Drive map commands may contain server and volume referrences:
  233.  
  234. ========================================================
  235. EndComment
  236.  
  237. NovMapRoot ('H', HomeDir)            ;Home Directory
  238. NovMapRoot ('N','SYS:PUBLIC\NSK')    ;Network Survival Kit
  239. NovMapRoot ('O', DosDir)             ;Dos Directory
  240. NovMapRoot ('U','SYS:PUBLIC\UTIL')   ;Utilities Directory
  241. NovMapRoot ('P','SYS:PUBLIC')        ;Public Directory
  242. NovMapRoot ('L','SYS:LOGIN')         ;Login Directory
  243.  
  244. Comment
  245. ========================================================
  246.  
  247. Here we set a different directory for a program depending on if we
  248. have a color or monochrome monitor.
  249.  
  250. ========================================================
  251. EndComment
  252.  
  253. if VideoMode = Mono
  254.    SmartDir = 'SYS:PUBLIC\MSMART'
  255. else
  256.    SmartDir = 'SYS:PUBLIC\CSMART'
  257. endif
  258.  
  259. if ExistDir SmartDir
  260.    NovMapRoot ('S',SmartDir)
  261. endif
  262.  
  263. Comment
  264. ========================================================
  265.  
  266. W: is a work drive. When an application needs an extra search path, I
  267. move W: to that directory.
  268.  
  269.  OnKey 'L'
  270.    |NovMapRoot('W','\PUBLIC\LOTUS')
  271.    Lotus
  272.  
  273. ========================================================
  274. EndComment
  275.  
  276. NovMapRoot('W','H:')
  277.  
  278. if NovConsoleOperator
  279.    NovMapRoot ('V','F:\SYSTEM')     ;System Directory
  280. endif
  281.  
  282. if MyServer = 'TYME'
  283.  
  284.  
  285.    ;----- Here's where I log into a second server.
  286.  
  287.    if PosInList('SHOW',Servers) > 0
  288.       NovLogin('SHOW/' + UserName,OldPass)
  289.       NovMapDrive('K','SHOW/SYS:')
  290.    endif
  291.  
  292.    ;----- Here's where I log into a third server.
  293.  
  294.    if PosInList('TSS',Servers) > 0
  295.       NovLogin('TSS/' + UserName,OldPass)
  296.       NovMapDrive('J','TSS/SYS:')
  297.    endif
  298.  
  299.    ;----- Here's where I log into another server.
  300.  
  301.    if PosInList('MARX',Servers) > 0
  302.       NovLogin('MARX/' + UserName,OldPass)
  303.       NovMapDrive('G','MARX/SYS:')
  304.    endif
  305.  
  306. endif
  307.  
  308. NovVolumes(Vols)
  309.  
  310. if PosInList('VOL1',Vols) > 0 then NovMapDrive ('I','VOL1:')
  311.  
  312. ;----- Turbo Pascal 6
  313.  
  314. if ExistDir ('H:\BP7')
  315. ;   %RTM% = "EXTLEAVE 2048"
  316.    NovMapRoot ('T','H:\BP7\BIN')
  317. endif
  318.  
  319. ;----- If no drive C then use home directory
  320.  
  321. if Floppies < 3                     ;I'm using some 4 floppy machines
  322.    if not ExistDir ('C:\') then NovMapRoot('C','H:')
  323. endif
  324.  
  325. ;----- Here we define our search paths.
  326.  
  327. %PATH% = 'T:\;H:\;W:\;U:\;N:\;O:\;P:\;V:\;S:\;'
  328.  
  329. FixPath    ;Verifies all search paths exist
  330.  
  331. ChDir 'F:'
  332. ChDir (HomeDir)
  333.  
  334. ;----- Here's where we set master environment variable strings
  335.  
  336. %STATION% = Station
  337. if Left(Shell,2) <> 'C:' and ExistFile('O:\COMMAND.COM')
  338.    %COMSPEC% = 'O:\COMMAND.COM'
  339. endif
  340. %PROMPT% = '$e[1;33m$p: $e[0;32m'      ;ansi required
  341. %MXECHO% = 'OFF'
  342. %MV% = MyServer + '/SYS:'              ;MHS
  343. %NWLANGUAGE% = 'ENGLISH'
  344.  
  345. ;----- Check for personal menu.
  346.  
  347. if ExistFile('H:\' + UserName + '.MNU')
  348.    %PMENU% = UserName + '.MNU'
  349. endif
  350.  
  351. ;----- Here's where I set up for Pick Directory
  352.  
  353. if UserName <> 'MARC'
  354.    SetEnv('PD.EXE=/$F:\HOME\PD.PIC')
  355. else
  356.    SetEnv('PD.EXE=/$H:\PD.PIC')
  357. endif
  358.  
  359. Comment
  360. ========================================================
  361.  
  362. Opens a semaphore that XMETER can read.
  363. To see how many users are users are on with XMETER type:
  364. XMETER LOGIN /U
  365.  
  366. =====================================}==================
  367. EndComment
  368.  
  369. NovOpenSemaphore ('XM-LOGIN',0)
  370.  
  371. ;----- Turn NumLock key on if in NumLock group.
  372.  
  373. if InGroup 'NUMLOCK'
  374.    NumLock On
  375. else
  376.    NumLock Off
  377. endif
  378.  
  379. ;----- LOGIN is set to BOOTUP if logging in for the first time
  380.  
  381. if UpperCase(%BOOTUP%) <> 'LOGIN' then ExitMenu
  382.  
  383. Comment
  384. ========================================================
  385.  
  386. In order to load TSRs, MarxMenu writes a temporary batch file and
  387. exits. The STARTUP.BAT file then jumps to this batch file.
  388.  
  389. ========================================================
  390. EndComment
  391.  
  392. ;----- Create temporary batch file for rest of login sequence
  393.  
  394. %BOOTUP% = BatFileName
  395.  
  396. ;----- To debug, set ECHO ON and add PAUSE commands
  397.  
  398. ; Bat 'ECHO ON'
  399.  
  400. Bat 'SET BOOTUP='     ;clear BOOTUP environment variable
  401.  
  402. ;----- Set BREAK to ON if NovConsoleOperator
  403.  
  404. if NovConsoleOperator then Bat 'BREAK ON'
  405.  
  406. Comment
  407. ========================================================
  408.  
  409. Here's where we load up all the TSRs the user is going to use. We set
  410. the environment variable TSR to Y to indicate that TSRs are loaded. This
  411. way if we log out and then back in we won't load them twice.
  412.  
  413. ========================================================
  414. EndComment
  415.  
  416. TsrLoaded = %TSR% = 'Y'
  417.  
  418. if not TsrLoaded
  419.  
  420.    %TSR% = 'Y'
  421.  
  422.    ;----- Load Task Switch Support
  423.  
  424.    if InGroup 'TASKMAX'
  425. ;      Bat LoadHigh 'TBMI2'
  426.    endif
  427.  
  428.    ;----- Load Mouse
  429.  
  430.    if InGroup 'MOUSE'
  431.       Bat LoadHigh 'P:\WINDOWS\MOUSE'
  432.    endif
  433.  
  434.    ;----- Load CastAway
  435.  
  436.    if InGroup 'CASTAWAY'
  437.       Bat 'P:\EXPR\CASTAWAY N /W=0 /I=0 /H'
  438.       Bat 'CASTON'
  439.    endif
  440.  
  441.    ;----- Load BRequest
  442.  
  443.    if InGroup 'BREQ'
  444.       Bat LoadHigh 'BREQUEST'
  445.    endif
  446.  
  447.    ;----- Load BTrieve
  448.  
  449.    if InGroup 'BTRIEVE'
  450.       Bat LoadHigh 'BTRIEVE /E'
  451.    endif
  452.  
  453.    ;----- Load Map Assist
  454.  
  455.    if InGroup 'CDROM'
  456.       Bat 'P:\MAPA\MACLIENT UPPER G:=BBS3'
  457.    endif
  458.  
  459.    ;----- Load Lan Assist
  460.  
  461.    if InGroup 'LANASSIST'
  462.       if InGroup 'LA-RES'
  463.          Bat LoadHigh 'P:\LA\LA /L'
  464.       else
  465.          Bat LoadHigh 'P:\LA\LA +N'
  466.       endif
  467.    endif
  468.  
  469.    ;----- Load ExpressIT Mail System
  470.  
  471.    if InGroup 'EXPRESSIT'
  472.       Bat 'P:\EXPR\EXPRESSM F12'
  473.    endif
  474.  
  475.    ;----- Load SideKick if in Sidekick Group
  476.  
  477.    if InGroup 'SIDEKICK'
  478.       Bat 'KBD CR'
  479.       Bat LoadHigh 'SWAPSK/N/G/DH:\ >NUL'
  480.       Bat 'SK'
  481.       Bat 'CLS'
  482.    endif
  483.  
  484.    ;----- Load SideKick 2 if in SK2 Group
  485.  
  486.    if InGroup 'SK2' and not DrDos6
  487.       Bat LoadHigh 'P:\SK2\SK2'
  488.    endif
  489.  
  490.    ;----- Load MarxPop
  491.  
  492.    if InGroup 'MARXPOP' and not DrDos6
  493.       Bat 'MarxPop H:MarxPop.cfg'
  494.    endif
  495.  
  496. endif
  497.  
  498. Capture('LASER',2)
  499.  
  500. Comment
  501. ================================================================
  502.  
  503. This next section deals with running special programs bases on the
  504. physical station number rather than by user. This deals with special
  505. hardware that needs software drivers loaded.
  506.  
  507. ================================================================
  508. EndComment
  509.  
  510. if NovStationAddress = '254:93'
  511. ;   TextMode Mono
  512. endif
  513.  
  514. ;----- Set Keyboard Speed Faster if 286 or greater.
  515.  
  516. if CPUClass > 1 then Bat 'KBD 6'
  517.  
  518. Comment
  519. ================================================================
  520.  
  521. This next section deals with running special programs bases on the
  522. users preferrences.
  523.  
  524. ================================================================
  525. EndComment
  526.  
  527. if UserName = 'MARC'
  528.    Capture('DOT',1)
  529.    ChDir('BP7\MARX')
  530. endif
  531.  
  532. if UserName = 'VICKI'
  533. ;   if not TsrLoaded then Bat(LoadHigh 'MOUSE')
  534. ;   BAT 'f:\public\mscdex.exe /D:MSCD001 /L:D /M:'
  535.    Bat LoadHigh 'P:\SK2\SK2'
  536. endif
  537.  
  538. ;---- Map \home\phil\batch as drive 'Q' for user Phil
  539.  
  540. if UserName = 'PHIL'
  541.     NovMapRoot('Q','f:\home\phil\batch')
  542.     %PATH% = 'Q:\;T:\;H:\;W:\;U:\;N:\;O:\;P:\;V:\;S:\;'
  543.     FixPath    ;Verifies all search paths exist
  544. endif
  545.  
  546. if UserName = 'KEVIN'
  547.    Capture('DOT',2)
  548.    %PROMPT% = '($p)'
  549.    %PATH% = %PATH% + 'f:\home\kevin\brief'
  550.    ChDir('MARX')
  551. endif
  552.  
  553. if UserName = '386'
  554.    Capture('DOT',1)
  555. endif
  556.  
  557. if UserName = 'TSS'
  558.    NovMapDrive('G','F:')
  559.    %BOOTUP% = '\LOGIN\TSS.BAT'
  560.    exitmenu
  561. endif
  562.  
  563. if InGroup 'BBS'
  564.    Capture('DOT',1)
  565.    NovMapRoot('W','F:\BBS\FAXPAK')
  566.    NovMapRoot('V','F:\BBS')
  567.    NovMapRoot('Y','F:\HOME\MARC')
  568.    NovMapRoot('Z','F:\HOME\MARC\BP7\MARX')
  569.    %FAXDIR% = 'C:\FAX'
  570.    SetEnv('D.EXE=/O/I')
  571.    Bat 'CD FAX'
  572.    Bat 'CASMGR CASMGR.CFG'
  573.    Bat 'DROPTO S'
  574. endif
  575.  
  576. if UserName = 'WORK'
  577.    Capture('DOT',1)
  578. endif
  579.  
  580. if UserName = 'MHS'
  581.    Capture('DOT',1)
  582.    ChDir('F:\MHS\EXE')
  583.    NovMapDrive('H','F:')
  584.    %MXCMD% = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
  585.    Bat 'MHSNOTFY'
  586.    Bat 'MHSRESET'
  587.    Bat 'DROPTO MHS'
  588. endif
  589.  
  590. Comment
  591. ================================================================
  592.  
  593. The batch file ends by jumping to personal menu, if there is one, or
  594. the default menu if there isn't. DROPTO.BAT is used to erase the
  595. temporary batch file that this menu creates.
  596.  
  597. TMAX.BAT
  598. --------
  599. taskmax /f
  600. marxmenu novmax
  601. dolist
  602.  
  603. ================================================================
  604. EndComment
  605.  
  606. if DrDos6 and InGroup 'TASKMAX'
  607.    Bat 'DROPTO TMAX.BAT'
  608. endif
  609.  
  610. if ExistFile ('F:\HOME\' + UserName + '\' + UserName + '.MNU')
  611.    Bat 'DROPTO MARX ' UserName
  612. endif
  613.  
  614. Bat 'DROPTO N:MARX TYME'
  615.  
  616. ExitMenu
  617.  
  618. ;===============================================================
  619. ;===============================================================
  620.  
  621. ;----- Procedure Definitions
  622.  
  623. Procedure Capture (Queue, PrinterPort)
  624.    NovCaptureQueue(PrinterPort) = Queue
  625.    NovCaptureTimeOut(PrinterPort) = 5     ;5 second timeout
  626. EndProc
  627.  
  628.  
  629. Procedure LoadHigh
  630.    if %OS2% = 'Y'
  631.       Return 'LOADHIGH '
  632.    else
  633.       Return 'P:\QEMM\LOADHI.COM '
  634.    endif
  635. EndProc
  636.  
  637.  
  638. Comment
  639. ========================================================
  640.  
  641. If Environment variables USERNAME and PASSWORD are set, this menu
  642. will attempt to log into the network using these values. This allows
  643. for automatic login. You can also pass the parameters on the command
  644. line as follows.
  645.  
  646. MarxMenu Login <Name> <Password>
  647.  
  648. The name may contain a referrence to a server: Server/Name
  649.  
  650. ========================================================
  651. EndComment
  652.  
  653. ;----- Try Automatic Login using Environment Variables
  654.  
  655. Procedure TryAutoLogin
  656.    if Logged then Return
  657.    if CapsLock
  658.       CapsLock Off
  659.    else
  660.       UserName = ParamStr(2)
  661.       if UserName = '' then UserName = %USERNAME%
  662.       if UserName > ''
  663.          OldPass = ParamStr(3)
  664.          if OldPass = '' then OldPass = %PASSWORD%
  665.          SkipError = True
  666.          Login (UserName,OldPass)
  667.          SkipError = False
  668.          if PasswordNeedsChanged
  669.             Logged = False
  670.             Suggest 'C'
  671.          endif
  672.       endif
  673.    endif
  674. EndProc
  675.  
  676. ;----- Select colors and prepare screen
  677.  
  678. Procedure LoginFromScreen
  679.    if ColorScreen
  680.       TextColor White Red
  681.       BoxBorderColor Green Brown
  682.       BoxInsideColor Black Brown
  683.       ClearScreen 176
  684.       ClockColor Black Brown
  685.       TextColor Black Green
  686.       BoxHeaderColor Yellow Mag
  687.       Shadow
  688.    else
  689.       TextColor Grey Black
  690.       ClearScreen 176
  691.       TextColor Black Grey
  692.       BoxBorderColor Black Grey
  693.       BoxInsideColor Black Grey
  694.       BoxHeaderColor Black Grey
  695.       ClockColor Black Grey
  696.    endif
  697.    BlankMessage = 'Netware Login'
  698.    ClockMode = 262
  699.    GotoXY 1 25
  700.    ClearLine
  701.    WriteCenter "Computer Tyme Master Network Login Menu"
  702.    SingleLineBox
  703.    Explode Off
  704.    ShadowColor Grey Red
  705.    if ColorScreen
  706.       DrawBox 3 2 74 5
  707.       ClockPos 42 5
  708.       TextColor Blue Brown
  709.    else
  710.       DrawBox 3 2 76 5
  711.       ClockPos 44 5
  712.    endif
  713.    WriteCenter 'Computer Tyme Software Development Laboratory'
  714.    Writeln
  715.    TextColor Black Brown
  716.    WriteCenter '───────────────────────────────────────────────────────'
  717.    Writeln
  718.    TextColor Black Brown
  719.    Write "  (C) 1990-92 by Marc Perkel"
  720.    DoubleLineBox
  721.    BlankTime = 10
  722.  
  723.    Explode On
  724.    BlockBox
  725.    BoxBorderColor Green Blue
  726.    BoxInsideColor Yellow Blue
  727.    BoxHeader = " Station Information "
  728.    if ColorScreen
  729.       DrawBox 39 17 38 6
  730.       TextColor Yellow Blue
  731.    else
  732.       DrawBox 41 17 38 6
  733.       TextColor Grey Black
  734.    endif
  735.  
  736.    StatusWin = CurrentWindow
  737.    UpdateStatusWindow
  738.  
  739.    ChooseOption
  740.  
  741.    EraseTopWindow
  742.    EraseTopWindow
  743.    EraseTopWindow
  744.    TextColor Grey Black
  745.    ClearScreen
  746. EndProc
  747.  
  748.  
  749. Procedure ChooseOption
  750. var Ch X
  751.    repeat
  752.       X = 4
  753.       if NumberOfElements(Servers) > 1 then X = 5
  754.  
  755.       DrawBox 3 17 26 X
  756.       UseArrows
  757.       OnScreenOnly
  758.       InverseColor Yellow Cyan
  759.       Writeln '  L - Login to Network'
  760.       Write   '  C - Change Password'
  761.       if NumberOfElements(Servers) > 1
  762.          Writeln
  763.          Write   '  S - Select Server'
  764.       endif
  765.  
  766.       Ch = UpperCase(ReadKey)
  767.       if (Ch = 'L') or (Ch = 'C') or (Ch = 'S')
  768.          EraseTopWindow
  769.          if Ch = 'L'
  770.             LoginToNetwork (False)
  771.          endif
  772.          if Ch = 'C'
  773.             LoginToNetwork (True)
  774.          endif
  775.          if Ch = 'S'
  776.             SelectServer
  777.          endif
  778.       endif
  779.    until Logged
  780. EndProc
  781.  
  782.  
  783. Procedure Warning (St)
  784.    BoxHeader ' Warning '
  785.    DrawBox 3 17 length(St) + 4 3
  786.    Write Char(7) ' ' St
  787.    Wait 300
  788.    EraseTopWindow
  789. EndProc
  790.  
  791.  
  792. Procedure LoginToNetwork (CP)
  793. var NewPassVerify
  794.    BoxHeader = ' Logging into Server * ' + MyServer + ' '
  795.    DrawBox 3 10 50 4
  796.    UseArrows Off
  797.    Security
  798.    repeat
  799.       while (UserName = '') and (LastKey <> Esc)
  800.          ClearScreen
  801.          Write ' Name: '
  802.          UserName = UpperCase(Readln)
  803.          Writeln
  804.       endwhile
  805.       if LastKey <> Esc
  806.          SkipError = True
  807.          Login (UserName,'')      ;try no password
  808.          SkipError = False
  809.          if not NameAgain
  810.             if not Logged
  811.                Write ' Password: '
  812.                OldPass = UpperCase(Readln)
  813.                Write CR
  814.                ClearLine
  815.                Login (UserName,OldPass)
  816.             endif
  817.             if not CP
  818.                CP = PasswordNeedsChanged
  819.                if CP then Warning('Time to change your password!')
  820.             endif
  821.             if CP
  822.                if LastKey <> Esc
  823.                   repeat
  824.                      Write ' New Password: '
  825.                      NewPass = UpperCase(Readln)
  826.                      Write CR
  827.                      ClearLine
  828.                      if NewPass = OldPass then Warning('Select a NEW Password!')
  829.                   until NewPass <> OldPass
  830.                endif
  831.                if LastKey <> Esc
  832.                   Write ' Verify: '
  833.                   NewPassVerify = UpperCase(Readln)
  834.                   Write CR
  835.                   ClearLine
  836.                   if NewPass = NewPassVerify
  837.                      NovChangePassword (OldPass,NewPass)
  838.                      if NovResult <> 0
  839.                         Warning ('Password Change Failed!')
  840.                         Logged = False
  841.                      endif
  842.                   else
  843.                      Warning('Password Typed Wrong!')
  844.                      Logged = False
  845.                   endif
  846.                endif
  847.             endif
  848.          endif
  849.       endif
  850.       if not Logged
  851.          UserName = ''
  852.       endif
  853.    until (LastKey = Esc) or Logged
  854.    EraseTopWindow
  855. EndProc
  856.  
  857.  
  858. Procedure Login (User, Pass)
  859.    NovLogin (MyServer + '/' + User, Pass)
  860.    if NovResult = 223 then NovResult = 0  ;grace login
  861.    Logged = NovResult = 0
  862.    NameAgain = False
  863.    if Logged
  864.       NovMapDrive('F',MyServer + '/SYS:LOGIN')
  865.    endif
  866.    if not Logged
  867.       NameAgain = True
  868.  
  869.       if NovResult = 254
  870.          Warning('All Logins Disabled!')
  871.  
  872.       elseif NovResult = 252
  873.          Warning('Invalid User Name!')
  874.  
  875.       elseif NovResult = 220
  876.          Warning('Account Disabled!')
  877.  
  878.       elseif (NovResult = 218) or (NovResult = 219)
  879.          Warning('Invalid Login Time!')
  880.  
  881.       elseif NovResult = 197
  882.          Warning('Intruder Lockout!')
  883.  
  884.       else
  885.          NameAgain = False
  886.  
  887.       endif
  888.  
  889.       if SkipError then Return
  890.  
  891.       NameAgain = False
  892.  
  893.       if Pass = '' then Return
  894.  
  895.       if NovResult = 214
  896.          Warning('Requires Encrypted Password!')
  897.  
  898.       elseif NovResult = 222
  899.          Warning('Password Expired!')
  900.  
  901.       elseif NovResult = 255
  902.          Warning('Bad Password!')
  903.  
  904.       else
  905.          Warning('Login Failed! '+ Str(NovResult))
  906.  
  907.       endif
  908.  
  909.    endif
  910. EndProc
  911.  
  912.  
  913. Procedure PasswordNeedsChanged
  914. var X
  915.    X = NovPasswordExpDate (UserName)
  916.    if X = 0 then Return False
  917.    Return (X - Today) / SecondsInDay <= 5
  918. EndProc
  919.  
  920.  
  921. Procedure SelectServer
  922. var St
  923.    DrawBox 25 9 20 Min(NumberOfElements (Servers) + 2,10)
  924.    St = PickOne (Servers)
  925.    if St = '' then Return
  926.    MyServer = St
  927.    NovSetPrimaryServer (MyServer)
  928.    NovSetPreferredServer (MyServer)
  929.    EraseTopWindow
  930.    UpdateStatusWindow
  931. EndProc
  932.  
  933.  
  934. Procedure UpdateStatusWindow
  935.    SetTopWindow StatusWin
  936.    ClearScreen
  937.    Station = Str(NovConnection)
  938.    while length(Station) < 3
  939.       Station = '0' + Station
  940.    endwhile
  941.    Writeln '           Server: ' MyServer
  942.    Writeln '          Network: ' NovStationAddress
  943.    Writeln '       Connection: ' Station
  944.    Write   '      DOS Version: ' DosVersionString
  945.    if StatusWin <> CurrentWindow
  946.       SetWindowUnder (StatusWin,StatusWin + 1)
  947.    endif
  948. EndProc
  949.  
  950. ;----- Returns True if in list
  951.  
  952. Procedure InGroup (Group)
  953.    Return PosInSortedList(UpperCase(Group),MyGroups) > 0
  954. EndProc
  955.  
  956. ;----- Return True if after hours
  957.  
  958. Procedure AfterHours
  959.    Return (DayOfWeek = Sun) or (DayOfWeek = Sat) or (Hour > 17) or (Hour < 7)
  960. EndProc
  961.  
  962. ;----- Show Item for Debugging
  963.  
  964. Procedure ShowMe (Item)
  965.    DrawBox 1 23 80 3
  966.    Write ' '
  967.    TextColor Yellow Cyan
  968.    Write Item
  969.    Wait 300
  970.    EraseTopWindow
  971. EndProc
  972.  
  973.